package com.cn.config;
import org.apache.curator.utils.ZKPaths;

public class IZkClientMain {
    public static void main(String[] args) throws Exception {
        String configLocation = "curator-config.properties";
        IZkClient iZkClient = new IZkClient(configLocation);
        String value = "curator-demo";
        String path = "/curator/child/0";

        iZkClient.replace(path, value.getBytes("utf-8"));
        //simple method;
        String nodeName = ZKPaths.getNodeFromPath(path);
        System.out.print(nodeName);
        //value
        byte[] bytes = iZkClient.getData(path);
        System.out.println(new String(bytes, "utf-8"));
        Thread.sleep(180000 * 2);
        iZkClient.close();
    }
}
